package com.example.zsgc.tools;





import com.example.zsgc.dao.BaseDao;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigManager {
    private static Properties properties;
    private static ConfigManager configManager=new ConfigManager();


    //私有构造器 读取配置文件
    private ConfigManager(){
        properties=new Properties();
        String configFile="database.properties";
        InputStream is= BaseDao.class.getClassLoader().getResourceAsStream(configFile);
        try {
            properties.load(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //全局访问点
    private static ConfigManager getInstance(){
        return configManager;
    }

    private String getValue(String key){
        return properties.getProperty(key);
    }

}
